<?if($data->actions == 'platonic'):?>
<a id="like" href="javascript:likeback();"><?=_('Like back')?></a>
<?elseif($data->actions == 'match'):?>
<a id="like" href="javascript:unlike();"><?=_('Unlike')?></a>
<?elseif($data->actions == 'awaiting'):?>
<a id="like"><?=_('Awaiting reply')?></a>
<?elseif(!$data->settings->ilike || $data->settings->ilike->request):?>
<div class="profileActions">
    <a id="_1" class="action _1">&nbsp;</a>
    <a id="_2" class="action _2">&nbsp;</a>
    <a id="_3" class="action _3">&nbsp;</a>
    <a id="_4" class="action _4">&nbsp;</a>
    <a id="_5" class="action _5">&nbsp;</a>
    <a id="_6" class="action _6">&nbsp;</a>
</div>

<?/* href="javascript:actions_send(this,<?=UID?>,<?=$data->profile->ID?>);"

<img src="http://<?=DOMAIN?>/apps/actions/template/images/actions.png" alt="actions" >
<a id="like" href="javascript:like();"><?=_('Like')?></a>
*/endif;?>
<script type="text/javascript">
    $$('a.action').addEvent('click',function(e){
        tool.confirm('<?=_("Confirm")?>','<a class="action '+this.id+'">&nbsp;</a><?=("Are you sure sent the action to this member?")?><br /><div class="clear"></div>','_like()');
    });
function _like(){
	tool.post({'url':'/json/actions/like',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	{
				$('like').set({'href':'javascript:unlike();','text':'<?=_('Unlike')?>'});
				return tool.result(200,'<?=_('Successfull')?>','<?=_('Your like has been sent.')?>');
			}
			else return tool.result(400,'<?=_('Alert')?>','<?=_('Please try again later..')?>');
		}
	});
}
function likeback(){
	tool.confirm('<?=_('Confirm')?>','<?=_('Are you sure you want to `like back` this member?')?>','_likeback()');
}
function _likeback(){
	tool.post({'url':'/json/ilike/likeback',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	$('like').set({'href':'javascript:unlike();','text':'<?=_('Unlike')?>'});
			else return tool.result(400,'<?=_('Alert')?>','<?=_('Please try again later..')?>');
		}
	});
}
function unlike(){
	tool.confirm('<?=_('Confirm')?>','<?=_('Are you sure you want to `unlike` this member?')?>','_unlike()');
}
function _unlike(){
	tool.post({'url':'/json/ilike/unlike',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	$('like').set({'href':'javascript:like();','text':'<?=_('Like')?>'});
			else return tool.result(400,'<?=_('Alert')?>','<?=_('Please try again later..')?>');
		}
	});
}
</script>